package com.audible.library.domain.beans;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;

/**
 * This is a lightweight persistence domain object representing primary key in user_audio_book_rating table in the database.
 *
 * @author Jigar Shah
 * @version 0.1
 */
@Embeddable
public class UserAudioBookRatingPK implements Serializable {
    
    private static final long serialVersionUID = 4513204724932752730L;

    @Basic(optional = false)
    @Column(name = "USER_AUDIO_BOOK_USER_PROFILE_ID")
    private int userAudioBookUserProfileId;

    @Basic(optional = false)
    @Column(name = "USER_AUDIO_BOOK_AUDIO_BOOK_ID")
    private int userAudioBookAudioBookId;

    public UserAudioBookRatingPK() {
    }

    public UserAudioBookRatingPK(int userAudioBookUserProfileId, int userAudioBookAudioBookId) {
        this.userAudioBookUserProfileId = userAudioBookUserProfileId;
        this.userAudioBookAudioBookId = userAudioBookAudioBookId;
    }

    public int getUserAudioBookUserProfileId() {
        return userAudioBookUserProfileId;
    }

    public void setUserAudioBookUserProfileId(int userAudioBookUserProfileId) {
        this.userAudioBookUserProfileId = userAudioBookUserProfileId;
    }

    public int getUserAudioBookAudioBookId() {
        return userAudioBookAudioBookId;
    }

    public void setUserAudioBookAudioBookId(int userAudioBookAudioBookId) {
        this.userAudioBookAudioBookId = userAudioBookAudioBookId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (int) userAudioBookUserProfileId;
        hash += (int) userAudioBookAudioBookId;
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof UserAudioBookRatingPK)) {
            return false;
        }
        UserAudioBookRatingPK other = (UserAudioBookRatingPK) object;
        if (this.userAudioBookUserProfileId != other.userAudioBookUserProfileId) {
            return false;
        }
        if (this.userAudioBookAudioBookId != other.userAudioBookAudioBookId) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.audible.library.domain.beans.UserAudioBookRatingPK[userAudioBookUserProfileId=" + userAudioBookUserProfileId + ", userAudioBookAudioBookId=" + userAudioBookAudioBookId + "]";
    }

}
